package com.dnjn.mes.biz.controller;

import com.dnjn.mes.biz.assist.ext.Wrapperz;
import com.dnjn.mes.biz.domain.MesEquipment;
import com.dnjn.mes.biz.enums.BoolType;
import com.dnjn.mes.biz.service.IMesEquipmentService;
import com.dnjn.mes.common.core.controller.BaseController;
import com.dnjn.mes.common.core.domain.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/open")
public class OpenController extends BaseController {

    @Autowired
    protected IMesEquipmentService equipmentService;

    @GetMapping("/currentEquipment")
    public AjaxResult current() {
        return success(equipmentService.getOne(
                Wrapperz.lambdaQuery(MesEquipment.class).eq(MesEquipment::getIsDefault, BoolType.YES)));
    }
}
